//Ex 5.4
#include <iostream>
#include <string>
#include <vector>
#include "Word.h"
#include "Line.h"
#include "Paragraph.h"
#include "FileReader.h"

int main()
{

    string fileName = "";
    vector< int > Lines;
    cout << "Please enter a file name: ";

    cin >> fileName;
    cout << endl;
    FileReader newFile( fileName );

    Paragraph newParagraph;
    newFile.readFileInto( newParagraph );


    string tempSearchWord = "";

    cout << "Please enter a word to search for or '.' to quit: ";
    cin >> tempSearchWord;
    cout << endl;

    while ( tempSearchWord != "." )
   {
        Word searchWord(tempSearchWord);
        //cout << tempSearchWord << endl;

        if (newParagraph.contains(searchWord, Lines)) //true
        {
            cout << "Word found:" << endl;
            for (int i=0; i<Lines.size(); i++)
            {
                cout << "line" << Lines[i] << endl;
            }
        }

        if (!newParagraph.contains(searchWord, Lines)) //false
        {
            cout << "Word not found" << endl;
        }


        cout << "Please enter a word to search for or '.' to quit: ";
        cin >> tempSearchWord;
        cout << endl;
   }

return 0;



}

